home *** CD-ROM | disk | FTP | other *** search
- /*------------------------------------------------------------------------------
- #
- # NewsTicker, my Hack for 1997
- #
- # HTMLExtractor.h - Base class to read an HTML page in, and parse
- # out the interesting stuff. Useless on its own,
- # only exists to be derived..
- #
- ------------------------------------------------------------------------------*/
- #ifndef HTMLEXTRACTOR_H
- #define HTMLEXTRACTOR_H
-
- // We can only use SubWoofer under PowerPC
- #ifdef powerc
- // Disable this to use our own OT code
- #define USESUBWOOFER
- #endif
-
- //+++Inc - Includes for files not directly related to this project
- #include <OpenTransport.h>
- #include <OpenTptInternet.h>
- #include <Types.h>
- #include "TickerGlobals.h"
-
- //These actually read the stuff in
- class SubWooferEndPoint;
- class HTTPEndPoint;
-
- // read a whole HTML file in, and parse it
-
- #define tempmaxHeadlines 50
-
- class HTMLExtractor
- {
- protected:
-
- #ifdef USESUBWOOFER
- SubWooferEndPoint* mfWebPipe;
- #else
- HTTPEndPoint* mfHTTPPipe;
- #endif
- Boolean mfDoingARead;
- Boolean mfReadingHeader;
- char mfAddress[32];
- short mfIconID;
- char thetext[2048];
- short thetextsize;
- char thetag[2048];
- short thetagsize;
- Str31 mfLastModified;
- Boolean AmOnTag;
- Boolean temp;
- sMyDataPtr mfTheDataPtr;
-
- sHeadline mfTempHeadlines[tempmaxHeadlines];
- short mfTempHeadlineCount;
-
-
- public:
- HTMLExtractor (char* theaddress, short theIconID, sMyDataPtr theDataPtr);
- virtual ~HTMLExtractor (void);
-
- // Called by base app to read all entries in, or check header and see if it's changed
- void ReadLastModified(void);
- void GetLastModified (Str31 LastModStr);
- // Called by base app to read all entries in
- void ReadEntries (void);
-
- // Called by endpoint as it gets strings
- void ReceiveString (char* string, short numchars);
-
- virtual void HandleToken(char* string, short numchars, Boolean isCommand);
- void AddEntry(Str255 theSubject, Str255 theURL);
- Boolean ParseGoodURL(char* thestring, Str255 theURL);
-
- virtual void Disconnect(void);
-
- void Cancel(void);
-
- };
-
- Boolean MyCompareStr(char* p1, char* p2);
- void FindATag(char* tag, char* theLink, char* theMarker);
-
-
- #endif //HTMLEXTRACTOR_H
-